$(function() {
	$('#vue_vm_list').hide();
});

function paperRecord_find() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list').hide();
	
	var staffId = getLoginedUser()? getLoginedUser().staffId: '';
	var paperType = $('#paperType').val();
	var searhVal = $('#searhVal').val();
	
	find_basic_by_json(path+'/paperRecord/find',
			{staffId:staffId, paperType:paperType, searhVal:searhVal}, function(response) {	
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			},
			methods: {
				getPaperTypeText:function(paperType) {
					var paperTypeText = '';
					
					switch(paperType==1) {
						case 1:
							paperTypeText = '发票';
							break;
						case 2:
							paperTypeText = '预交款收据';
							break;
						case 3:
							paperTypeText = '收费凭据';
							break;
					}
					
					return paperTypeText;
				},
				paperRecord_invalid:function(todo) {
					if(confirm('确实要作废吗？')) {
						save_basic_by_json(path+'/paperRecord/invalid', {id:todo.paperRecordId}, function() {
							$('#'+todo.paperRecordId+'_div').remove();
							todo.invalidStatus = 1;
							alert('作废成功');
						});
					}
				}
			}
		});
		
		$('#vue_vm_list').show();
	});
}